﻿<%@ Page Language="C#" MasterPageFile="~/Main.Master" AutoEventWireup="true" CodeBehind="PageReportTimesheet.aspx.cs" Inherits="ContractManagementSystem.PageReportTimesheet" Title="Untitled Page" %>
<%@ Register TagPrefix="cc1" Namespace="AjaxControlToolkit" Assembly="AjaxControlToolkit, Version=3.0.30512.20315, Culture=neutral, PublicKeyToken=28f01b0e84b6d53e" %>
<asp:Content ID="Content1" ContentPlaceHolderID="PanelContent" runat="server">
    <div class="divWrap">
    <h2 class="divTitle">
                List Timesheet</h2>
    <asp:UpdatePanel runat="server" ID="SearchUpdatePanel">
        <ContentTemplate>
            <asp:Panel runat="server" ID="searchPanel">
                <div id="timesheetSearch">
                    <fieldset style="width: 99%; margin: auto; padding-left: 7px;" class="border">
                        <legend><b>Search</b></legend>
                        <table style="width: 90%; margin: 15px auto 20px auto;">
                            <tbody>
                                <tr>
                                    <td>
                                        Contractor:
                                    </td>
                                    <td>
                                        <asp:Panel runat="server" ID="AdminAction" Style="display: inline;" Visible="false">                                            
                                            <asp:TextBox runat="server" ID="ContractorTextBox" Width="100px" ToolTip="Enter the ACCOUNT NAME of a Contractor"></asp:TextBox>
                                            <asp:Button runat="server" ID="ContractorSelectButton" Text="Check" ToolTip="Check and fill Contract of this Contractor to a combobox"
                                                OnClick="ContractorSelectButton_OnClick" />
                                            <asp:Literal runat="server" ID="CheckContractorLiteral" Visible="false" Text="Do not exist this Contractor!"></asp:Literal>
                                        </asp:Panel>
                                        <asp:DropDownList runat="server" Width="170px" ID="ContractorDropDownList" AutoPostBack="true"
                                            OnSelectedIndexChanged="ContractorDropDownList_OnSelectedIndexChanged">
                                        </asp:DropDownList>
                                    </td>
                                    <td>
                                        From date:
                                    </td>
                                    <td>
                                        <asp:TextBox Width="70%" ID="FromDateTextBox" runat="server"></asp:TextBox>
                                        <asp:ImageButton ID="Image" runat="server" CssClass="calender" ImageUrl="~/Images/calendar.png" />
                                        <cc1:CalendarExtender ID="CalendarExtender" CssClass="cal_Theme1" runat="server"
                                            TargetControlID="FromDateTextBox" PopupButtonID="Image" PopupPosition="Right"
                                            Format="MM/dd/yyyy">
                                        </cc1:CalendarExtender>
                                    </td>
                                    <td>
                                        Status:
                                    </td>
                                    <td>
                                        <asp:DropDownList ID="StatusDropDownList" runat="server" 
                                            onselectedindexchanged="StatusDropDownList_SelectedIndexChanged">
                                            <asp:ListItem>All</asp:ListItem>
                                            <asp:ListItem>Reject</asp:ListItem>
                                            <asp:ListItem>Pending</asp:ListItem>
                                            <asp:ListItem>Approved</asp:ListItem>
                                        </asp:DropDownList>
                                    </td>
                                </tr>
                                <tr>
                                    <td>
                                        Contract:
                                    </td>
                                    <td>
                                        <asp:DropDownList runat="server" Width="170px" ID="ContractDropDownList" AutoPostBack="true" OnSelectedIndexChanged="ContractDropDownList_OnSelectedIndexChanged" />
                                    </td>
                                    <td>
                                        To date:
                                    </td>
                                    <td>
                                        <asp:TextBox Width="70%" ID="ToDateTextBox" runat="server"></asp:TextBox>
                                        <asp:ImageButton ID="ImageButton" runat="server" CssClass="calender" ImageUrl="~/Images/calendar.png" />
                                        <cc1:CalendarExtender ID="CalendarExtender1" CssClass="cal_Theme1" runat="server"
                                            TargetControlID="ToDateTextBox" PopupButtonID="ImageButton" PopupPosition="Right"
                                            Format="MM/dd/yyyy">
                                        </cc1:CalendarExtender>
                                    </td>
                                    <td>
                                    </td>
                                    <td>
                                    </td>
                                </tr>
                            </tbody>
                        </table>
                        <div style="margin: 10px auto 10px auto; width: 100%;" align="center">
                            <asp:Button ID="ListTimesheetButton" runat="server" Text="List TimeSheet" OnClick="ListTimesheetButton_OnClick"/>
                        </div>
                    </fieldset>
                </div>
            </asp:Panel>
        </ContentTemplate>
    </asp:UpdatePanel>
    <asp:Literal runat="server" ID="StatusLiteral" Visible="false"></asp:Literal>
    <asp:UpdatePanel runat="server" ID="TopTimesheetUpdatePanel">
        <ContentTemplate>
            <asp:Panel runat="server" ID="TopPanel" Visible="false">
                <asp:ListView runat="server" ID="TimesheetListView" ItemPlaceholderID="NewItem" 
                OnItemDataBound="TimesheetListView_OnItemDataBound">
                    <EmptyDataTemplate>
                        <h4 class="empty">There are no item to show in this view.</h4>
                    </EmptyDataTemplate>
                    <LayoutTemplate>
                        <table id="table">
                            <tr>
                                <asp:Panel runat="server" ID="HeaderConsultantPanel">
                                <th style="width: 2%;">
                                    <input type="checkbox" id="SelectAllCheckBox" onclick="javascript:ForHeaderCheckBox(this);" />
                                </th>
                                </asp:Panel>
                                <th style="width: 12%;">
                                    <div style="width: 81%;">
                                        WorkDate</div>
                                </th>
                                <th style="width: 4%;">
                                    <div style="width: 75%;">
                                        Time</div>
                                </th>
                                <th>
                                    <div style="text-align: center">
                                        Description</div>
                                </th>
                                <th style="width: 12%;">
                                    <div style="width: 81%; float: left;">
                                        Status</div>
                                </th>
                                
                            </tr>
                            <tr>
                                <asp:PlaceHolder runat="server" ID="NewItem"></asp:PlaceHolder>
                            </tr>
                        </table>
                    </LayoutTemplate>
                    <ItemTemplate>
                        <tr class="odd">
                            <asp:Panel runat="server" ID="ConsultantPanel">
                            <td>
                                <input type="checkbox" runat="server" id="ItemCheckBox" onclick="javascript:ForItemCheckBox(this);" value='<%# DataBinder.Eval(Container.DataItem, "TimesheetId") +"$"+ DataBinder.Eval(Container.DataItem,"Id")%>' />
                            </td>
                            </asp:Panel>
                            <td>
                                <asp:Label runat="server" ID="WordDateLabel" Text='<%# DataBinder.Eval(Container.DataItem, "WorkDate","{0:MM/dd/yyyy}")%>'></asp:Label>
                            </td>
                            <td>
                                <asp:Label runat="server" ID="WorkingTimeLabel" Text='<%# DataBinder.Eval(Container.DataItem, "WorkingTime")%>'></asp:Label>
                            </td>
                            <td>
                                <asp:Label runat="server" ID="DescriptionLabel" Text='<%# DataBinder.Eval(Container.DataItem, "Description")%>'></asp:Label>
                            </td>
                            <td>
                                <asp:Label runat="server" ID="StatusLabel" Text='<%# DataBinder.Eval(Container.DataItem, "Status")%>'></asp:Label>
                            </td>
                            <asp:Panel runat="server" ID="ActionPanel" Style="display: inline;">
                                <td>
                                    
                                </td>
                            </asp:Panel>
                            <asp:Panel runat="server" ID="StatusPanel" Style="display: inline;">
                                <td>
                                    
                                </td>
                            </asp:Panel>
                        </tr>
                    </ItemTemplate>
                    <AlternatingItemTemplate>
                        <tr class="alt">
                            <asp:Panel runat="server" ID="ConsultantPanel">
                            <td>
                                <input type="checkbox" runat="server" id="ItemCheckBox"  onclick="javascript:ForItemCheckBox(this);" value='<%# DataBinder.Eval(Container.DataItem, "TimesheetId") +"$"+ DataBinder.Eval(Container.DataItem,"Id")%>' />
                            </td>
                            </asp:Panel>
                            <td>
                                <asp:Label runat="server" ID="WordDateLabel" Text='<%# DataBinder.Eval(Container.DataItem, "WorkDate","{0:MM/dd/yyyy}")%>'></asp:Label>
                            </td>
                            <td>
                                <asp:Label runat="server" ID="WorkingTimeLabel" Text='<%# DataBinder.Eval(Container.DataItem, "WorkingTime")%>'></asp:Label>
                            </td>
                            <td>
                                <asp:Label runat="server" ID="DescriptionLabel" Text='<%# DataBinder.Eval(Container.DataItem, "Description")%>'></asp:Label>
                            </td>
                            <td>
                                <asp:Label runat="server" ID="StatusLabel" Text='<%# DataBinder.Eval(Container.DataItem, "Status")%>'></asp:Label>
                            </td>
                            <asp:Panel runat="server" ID="ActionPanel" Style="display: inline;">
                                <td>
                                  
                                </td>
                            </asp:Panel>
                            <asp:Panel runat="server" ID="StatusPanel" Style="display: inline;">
                                <td>
                                   
                                </td>
                            </asp:Panel>
                        </tr>
                    </AlternatingItemTemplate>
                </asp:ListView>
                <div style="text-align: center">
                <asp:Button ID="ReportButton" runat="server" Height="25px" Text="Report" 
                Width="76px" onclick="ReportButton_Click" />
                </div>
                <div class="divPage">
                    <asp:DataPager runat="server" ID="TimesheetDataPager" PagedControlID="TimesheetListView"
                        PageSize="14" OnPreRender="TimesheetDataPager_OnPreRender">
                        <Fields>
                            <asp:NumericPagerField CurrentPageLabelCssClass="curent" />
                        </Fields>
                    </asp:DataPager>
                </div>
            </asp:Panel>
        </ContentTemplate>
    </asp:UpdatePanel>
    <input type="hidden" id="hiddenBox" runat="server" />
    <input type="hidden" id="roleBox" runat="server"/>
    <asp:UpdatePanel runat="server" ID="HiddenUpdatePanel">
        <ContentTemplate>
            <input type="hidden" id="EndDateBox" runat="server"/>
            <input type="hidden" id="StartDateBox" runat="server"/>
        </ContentTemplate>
    </asp:UpdatePanel>
</div>

</asp:Content>
